www.gusucode.com > VC 很漂亮的对话框界面 > VC 很漂亮的对话框界面/gusucode/界面/ColorButton.cpp

    //Download by http://www.NewXing.com
// ColorButton.cpp : implementation file
//

#include "stdafx.h"
#include "Page.h"
#include "ColorButton.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CColorButton

CColorButton::CColorButton()
{
//	SetBackColor(RGB(222,223,222));
}

CColorButton::~CColorButton()
{
}


BEGIN_MESSAGE_MAP(CColorButton, CButton)
	//{{AFX_MSG_MAP(CColorButton)
	ON_WM_CTLCOLOR_REFLECT()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CColorButton message handlers



void CColorButton::SetBackColor(COLORREF BackColor)
{
	m_BackColor=BackColor;
	m_brush.CreateSolidBrush(m_BackColor);
}


HBRUSH CColorButton::CtlColor(CDC* pDC, UINT nCtlColor) 
{
	pDC->SetBkMode(TRANSPARENT);
	return (HBRUSH)m_brush;
}